Skip to content

Defeat buffer overflow #8

Merged
merged 3 commits into from
Oct 10, 2017
Merged

Defeat buffer overflow #8

merged 3 commits into from
Oct 10, 2017

Conversation

thomas
Copy link
Contributor

@thomas thomas commented Oct 9, 2017

The usage of good old sprintf causes trouble if the buffer is too small.

'valgrind --tool=exp-sgcheck' detected an invalid write
at former line 491 (sprintf...).

Using snprintf avoids this condition, and allows data loss
detection (Q: why not use the safer c++ strings, A:???).

This fix has some observable impact on bsmap's output,
although I've only seen a change in the amount of whitespace.

I also assume that this might be the cause for the crashes
at the end of bsmap execution.
so that the next commit will look cute :)
Introduce snprintf & LINEBUFFSIZE in similar section for
'single-read alignments'. This should make the code a bit
cleaner.
@donald donald merged commit 21e9c1d into master Oct 10, 2017
Sign in to join this conversation on GitHub.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants